#ifndef GUARD_COUNT_SORT_H
#define GUARD_COUNT_SORT_H
#include "misc.h"
#include <stdio.h>
void count_sort(int *a, int *b, int len)
{
    int c[MAX_VAL] = {0};
    int i = 0;
    int j = 0;
    for(i = 0; i <len; ++i)
    {
        ++c[a[i] - 1];
    }

    for(i = 1; i < MAX_VAL; ++i)
    {
        c[i] += c[i - 1];
    }

    for(j = len - 1; j >= 0; --j)
    {

        b[c[a[j] - 1] - 1] = a[j];
        --c[a[j] - 1];
    }
}

#endif